﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using log4net;
using RealState.BLL;
using RealState.BusinessObjects;
using RealState.Utils;

namespace RealState.W.AdminControl
{
    public partial class SupportCreate : System.Web.UI.UserControl
    {
        protected ILog log = LogManager.GetLogger(typeof(SupportCreate));
        private SupportsBLL m_SupportsBLL;
        private Supports m_SupportsDO;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            m_SupportsBLL = new SupportsBLL();
            m_SupportsDO = new Supports();
            try
            {
                m_SupportsDO.Fullname = txtFullName.Text;
                m_SupportsDO.Yahoo = txtYahoo.Text;
                int result = m_SupportsBLL.AddSupports(m_SupportsDO);
                if (result > 0)
                {
                    JavaScript.Success("Thêm mới thành công", Page, Request.Url.ToString());
                }
                else
                    JavaScript.Error("Có lỗi xảy ra ", Page);
            }
            catch (Exception ex)
            {
                log.Equals(ex.Message);
            }
            finally {
                m_SupportsDO = null;
                m_SupportsBLL = null;
            }
        }
    }
}